LSPS2 service: Treat replayed HTLCIntercepted events idempotently#4656
LSPS2 service: Treat replayed HTLCIntercepted events idempotently#4656tnull wants to merge 3 commits into
HTLCIntercepted events idempotently#4656Conversation
Persisting LSPS2 service state can race with replayed intercepted HTLC events after restart. Cover replaying the same intercepted HTLC after restoring peer state so duplicate queueing is caught. Co-Authored-By: HAL 9000
Replayed intercepted HTLC events should not duplicate queued payments or panic after restart. Ignore already-queued intercept IDs so persisted queues remain stable across event replay. Co-Authored-By: HAL 9000
|
I've assigned @jkczyz as a reviewer! |
686c27d to
190b6af
Compare
|
I've completed a thorough review of every hunk in this PR diff, examining:
No new issues found. The previously flagged |
Terminal JIT channel state is only useful while the forwarded channel still exists. Drop completed LSPS2 mappings once the channel is gone so persisted service state does not retain stale entries indefinitely. Co-Authored-By: HAL 9000
190b6af to
444c009
Compare
| /// - [`Event::ChannelReady`] to [`LSPS2ServiceHandler::channel_ready`] | ||
| /// - [`Event::HTLCHandlingFailed`] to [`LSPS2ServiceHandler::htlc_handling_failed`] | ||
| /// - [`Event::PaymentForwarded`] to [`LSPS2ServiceHandler::payment_forwarded`] | ||
| /// - [`Event::ChannelClosed`] to [`LSPS2ServiceHandler::channel_closed`] |
There was a problem hiding this comment.
Could you add a pending changelog for this?
| let Some(counterparty_node_id) = counterparty_node_id else { | ||
| return Ok(()); | ||
| }; |
There was a problem hiding this comment.
Elsewhere we return APIError::APIMisuseError. Should we do the same here?
| self.persist().await.map_err(|e| APIError::APIMisuseError { | ||
| err: format!( | ||
| "Failed to persist peer state after channel {} closed: {}", | ||
| channel_id, e | ||
| ), | ||
| })?; |
There was a problem hiding this comment.
I see we use this error elsewhere when persistence fails. Do we expect the caller to retry?
Fixes #4637.
Also: